import cv2
import matplotlib
import matplotlib.pyplot as plt

matplotlib.rcParams['font.sans-serif'] = ['SimHei']
matplotlib.rcParams['axes.unicode_minus'] = False


image1 = cv2.imread('./img/flowers.jpg')
image2 = cv2.imread('./img/sunflowers.jpg')

output_image = cv2.add(image1, image2)

plt.figure(figsize=(12, 6))  # 调整图像窗口大小

plt.subplot(1, 3, 1)
plt.imshow(cv2.cvtColor(image1, cv2.COLOR_BGR2RGB))
plt.title('图一')
plt.axis('off')

plt.subplot(1, 3, 2)
plt.imshow(cv2.cvtColor(image2, cv2.COLOR_BGR2RGB))
plt.title('图二')
plt.axis('off')

plt.subplot(1, 3, 3)
plt.imshow(cv2.cvtColor(output_image, cv2.COLOR_BGR2RGB))
plt.title('合成图')
plt.axis('off')

plt.show()
